// 市场销售 / 回访管理

import r from '@/utils/request'
import { type ListParams, type ListResponseType, type ResponseType } from '../types'

enum API {
    followupList = "/followup/list", // 回访列表
    followupAdd = "/followup/add", // 回访添加
    followupUpdate = "/followup/update", // 回访修改
    followupDelete = "/followup/delete", // 回访删除
}

export interface followupListParams extends ListParams{
    questionId:number
}

export interface followupListResAPI {
    id:              number;
    questionId:      number;
    callbackTime:    string;
    content:         string;
    addTime:         string;
    addAccountId:    number;
    addAccountName:  string;
    addAccountPhoto: string;
}

export function getfollowupListAPI(Params:followupListParams):Promise<ListResponseType<followupListResAPI[]>> {
    return r.get(API.followupList,Params)
}

export interface  followupAddAndUpdateParams {
    id:           number;
    questionId:   number;
    callbackTime: string;
    content:      string;
}

export interface followupAddAndUpdateResAPI {
    id:              number;
    questionId:      number;
    callbackTime:    string;
    content:         string;
    addTime:         string;
    addAccountId:    number;
    addAccountName:  string;
    addAccountPhoto: string;
}

export function followupAddAPI(Params:followupAddAndUpdateParams):Promise<ResponseType<followupAddAndUpdateResAPI>> {
    return r.post(API.followupAdd,Params)
}

export function followupUpdateAPI(Params:followupAddAndUpdateParams):Promise<ResponseType<followupAddAndUpdateResAPI>> {
    return r.put(API.followupUpdate,Params)
}

export function followupDeleteAPI(id:number):Promise<ResponseType<null>> {
    return r.delete(API.followupDelete+'/'+id)
}